home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13623 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.primenet.com!not-for-mail
  2. From: gbe@primenet.com (Gary Edstrom)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: static members of a class template
  5. Date: 26 Mar 1996 07:21:00 -0700
  6. Organization: Sequoia Software
  7. Sender: root@primenet.com
  8. Message-ID: <3157fb46.251410489@news.primenet.com>
  9. References: <315781CB.2DD1@digex.net>
  10. X-Posted-By: ip030.lax.primenet.com
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. What you want can't be done in this manner.  The problem below is that the
  14. static variable definition also needs a template declaration, but templates can
  15. only be applied to classes or functions, not to static variables.
  16.  
  17. "Steven D. Arnold" <yami@digex.net> wrote:
  18.  
  19. >Hi,
  20. >
  21. >How would you go about declaring a static member of a class template?  
  22. >Example:
  23. >
  24. >template<class kind>
  25. >class simple {
  26. >    private:
  27. >        static kind someVar;
  28. >};
  29. >
  30. >simple<kind> kind simple::someVar;
  31. >
  32. >
  33. >This seems to follow the general pattern for defining and declaring a 
  34. >static member, but it results in a syntax error.  What's the problem?
  35. >
  36. >Thanks in advance for any advice!
  37. >
  38. >-Steve-
  39.  
  40. --
  41. Gary Edstrom <gbe@primenet.com> | Sequoia Software
  42. PO Box 9573                     | Programming & Technical Services
  43. Glendale CA 91226-0573          | PGP Key ID: 0x1A0D44BD
  44. PGP Fingerprint: 72 AA 4F 73 05 53 89 C6  8A EE F4 EE D1 C0 13 8D 
  45.